package com.administrator.cloudapplication.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2017/4/12.
 */

public class CarouselAdapter extends PagerAdapter{
    List<View> mvList;
    public CarouselAdapter(List<View> mList){
       mvList=mList;
    }
    @Override
    public int getCount() {
        return mvList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }


    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        mvList.get(position).getParent();
        container.addView(mvList.get(position));
        return mvList.get(position);

    }

    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mvList.get(position));

    }
}
